<template>
	<view class="about">
		<view class="box">
			<image class="logoImg" :src="xtsetting.app_iconImg_file.url"></image>
			<text class="tip appName">{{xtsetting.appname}}</text>
			<text class="tip">Version {{version}}</text>
			<!--Sansnn-uQRCode组件来源，插件市场：https://ext.dcloud.net.cn/plugin?id=1287 微调后-->
			<Sansnn-uQRCode :text="xtsetting.app_Web_appdownload" :makeOnLoad="true" class="qrcode"></Sansnn-uQRCode>
			<text class="tip">扫描二维码，您的朋友也可以下载{{xtsetting.appname}}客户端</text>
		</view>
		<view class="copyright">
			<!-- #ifndef MP -->
			<template v-for="(agreement,index) in about.agreements">
				<text class="agreement" @click="navigateTo(agreement)">《{{agreement.title}}》</text>
				<text class="hint" v-if="about.agreements.length-1>index">和</text>
			</template>
			<!-- #endif -->
			<text class="hint">Copyright © {{year}}</text>
			<text class="hint">{{about.company}}</text>
		</view>
	</view>
</template>
<script>
	export default {
		onLoad() {
			// #ifdef APP-PLUS
			this.version = plus.runtime.version
			// #endif
		},
		computed:{
			uniStarterConfig(){
				console.log(getApp());
				return getApp().globalData.config
			}
		},
		data() {
			return {
				version:"V1.0.0",
				year:"2020",
				about:{},
				xtsetting:[]
			};
		},
		created() {
			console.log();
			this.about = this.uniStarterConfig.about
			uni.setNavigationBarTitle({
				title:'关于'+this.about.appName
			})
			this.year = (new Date).getFullYear()
		},
		onLoad() {
			let xtsetting = uni.getStorageSync('xtsetting')
			this.xtsetting = xtsetting
			//console.log(this.xtsetting)
			// #ifdef APP-PLUS
			//获取当前版本号
			console.log(plus.runtime.version)
			this.version = plus.runtime.version
			// uni.showModal({
			// 	title:'版本号',
			// 	content:plus.runtime.version
			// })
			// #endif
			
		},
		// onNavigationBarButtonTap() {
			
		// },
		methods:{
			// #ifndef MP
			navigateTo({url,title}){
				uni.navigateTo({
					url: '/pages/common/webview/webview?url='+url+'&title='+title,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			AppShare(){
				let {download,appName,slogan,logo} = this.about
				uniShare({
					content: { //公共的分享类型（type）、链接（herf）、标题（title）、summary（描述）、imageUrl（缩略图）
						type: 0,
						href: download,
						title: appName,
						summary: slogan,
						imageUrl: logo+'?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决，在ios端分享图过大导致的图片失效问题
					},
					menus: [
						// {
						// 	"img": "/static/app-plus/sharemenu/wechatfriend.png",
						// 	"text": "微信好友",
						// 	"share": {
						// 		"provider": "weixin",
						// 		"scene": "WXSceneSession"
						// 	}
						// },
						// {
						// 	"img": "/static/app-plus/sharemenu/wechatmoments.png",
						// 	"text": "微信朋友圈",
						// 	"share": {
						// 		"provider": "weixin",
						// 		"scene": "WXSenceTimeline"
						// 	}
						// },
						// {
						// 	"img": "/static/app-plus/sharemenu/weibo.png",
						// 	"text": "微博",
						// 	"share": {
						// 		"provider": "sinaweibo"
						// 	}
						// },
						// {
						// 	"img": "/static/app-plus/sharemenu/qq.png",
						// 	"text": "QQ",
						// 	"share": {
						// 		"provider": "qq"
						// 	}
						// },
						{
							"img": "/static/app-plus/sharemenu/copyurl.png",
							"text": "复制",
							"share": "copyurl"
						},
						{
							"img": "/static/app-plus/sharemenu/more.png",
							"text": "更多",
							"share": "shareSystem"
						}
					],
					cancelText: "取消分享",
				}, e => { //callback
					console.log(e);
				})
			}
			// #endif
		}
	}
</script>
<style lang="scss" scoped>
.about {
	width: 750upx;
	flex-direction: column;
}
.box {
	margin-top: 100px;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}
.logoImg{
	margin-bottom: 10upx;
	width:160upx;
	height:160upx;
	border-radius: 15px;
}
.tip{
	font-size:24rpx;
	margin-top: 10px;
}
.appName{
	margin-top: 20px;
	font-size:42rpx;
	font-weight: 500;
}
.qrcode{
	margin-top: 50px;
}
.copyright {
	width: 750upx;
	font-size:32rpx;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	bottom:20px;
	/* #ifdef H5 */
	bottom:80px;
	/* #endif */
	left: 0;
	position: fixed;
}
.agreement {
	color:#2285ff;
	font-size:26rpx;
}
.hint {
	color:#999999;
	font-size:26rpx;
}
</style>